// map863View.h : interface of the Cmap863View class
//


#pragma once
#include "dialogaddnewnode.h"
#include "map863doc.h"
#include "atltypes.h"
#include "dialogoutputconfigtofiles.h"
#include "dialogfindandreplace.h"

#include "afxwin.h"

class Cmap863View : public CScrollView
{
protected: // create from serialization only
	Cmap863View();
	DECLARE_DYNCREATE(Cmap863View)

// Attributes
public:
	Cmap863Doc* GetDocument() const;

// Operations
public:

//Display attributes for nodes and paths
public:
	enum DISPLAYATTRIB {Normal=0, Selected, Moving, Cutting, Pasting, Invisible };
	enum DISPLAYATTRIB NodeDisplayAttrib[MAXNODENUMBER];
	enum DISPLAYATTRIB PathDisplayAttrib[MAXPATHNUMBER];
	bool LineInShortestPath[MAXPATHNUMBER];
	bool m_IsShowShortestPath;

// Overrides
public:
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);

// Implementation
public:
	virtual ~Cmap863View();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
	DECLARE_MESSAGE_MAP()
public:

public:
	CDialogAddNewNode DialogAddNewNode;
public:
	int ActiveLayer;
public:

private:
	int m_NodeLastSelected;
	int m_NodeNumberLastSelected;
	int mh_HighLightLineEnd;
	int mh_NodewithMenu;
	CPoint mh_MousePosition;
	CPoint m_LButtonDownPosition;
public:
	bool m_DrawLButtonSelectedArea;
	bool m_IsDrawingPath;	//Indicates whether the flag of draw path is set
private:
	CPoint m_CurrentMousePosition;
	bool m_IsNodeMoving;
private:
	int m_NodeofMoving;
	CPoint m_CutPasteStartPosition;
	bool m_IsNodePasting;
	CDialogOutputConfigtoFiles DialogOutputConfig;

public:
	int m_ZoomScaler;
	int m_VisibleAreaTop;
	int m_VisibleAreaLeft;
public:

public:
	CPoint TransPosition(CPoint point);
	CPoint RePosition(CPoint point);
	CPoint DePosition(CPoint NodePoint);
public:
	bool DrawRectArea(CDC * pDC);
	bool DrawPath(CDC * pDC, int i);
	bool DrawNode(CDC * pDC, int i);

public:
	CPen pen_null;
	CPen ViewPen[15];

public:
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
public:
//	CScrollBar m_ScrollBar;
public:
	virtual void OnInitialUpdate();
public:
public:
	bool DrawMesh(CDC * pDC, int grid);
public:
	bool UpdateVisibleArea(void);

public:
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnNcLButtonUp(UINT nHitTest, CPoint point);
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg void OnUpdateDrawPath(CCmdUI *pCmdUI);
	afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
	afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
public:
	afx_msg void OnLoadImage();
public:
	afx_msg void OnNodeoptionBloomfilter();
	afx_msg void OnNodeoptionCalibration1();
	afx_msg void OnNodeoptionCalibration2();
	afx_msg void OnNodeoptionCalibration3();
public:
	afx_msg void OnToolsImage();
	afx_msg void OnToolsBehaviournet();
	afx_msg void OnToolsDownloadtool();
public:
	afx_msg void OnDrawPath();
	afx_msg void OnEditCut();
	afx_msg void OnEditMove();
	afx_msg void OnEditFind();
	afx_msg void OnEditReplace();
	afx_msg void OnEditModify();
	afx_msg void OnEditPaste();
	afx_msg void OnEditDel();
public:
	afx_msg void OnViewZoomin();
	afx_msg void OnViewZoomout();
	afx_msg void OnViewZoom100();
	afx_msg void OnViewBackgroundimage();
	afx_msg void OnViewNodename();
	afx_msg void OnViewNode();
	afx_msg void OnViewPath();
	afx_msg void OnViewMesh();
	afx_msg void OnViewRefresh();
public:
	bool CleanDisplayAttrib(void);
	bool DrawHighLightPath(CDC * pDC);
	CFont ViewFont;

public:
	bool m_IsShowNode;
	bool m_IsShowNodeName;
	bool m_IsShowPath;

public:
public:
	HBITMAP m_hBackgroundImage;
	CBitmap m_BackgroundImage;
public:
	bool m_IsShowBKGDImage;
	bool m_IsShowMesh;
public:
	bool m_IsFinding;
	CDialogFindandReplace * m_DialogFind;
public:
	CString m_CameraProgramPath;
	CString m_BEProgramPath;
	bool m_IsCameraProgramRunning;
	bool m_IsBEProgramRunning;
public:
public:
	afx_msg void OnToolsDemo();
public:
	afx_msg void OnUpdateToolsDemo(CCmdUI *pCmdUI);
public:
	afx_msg void OnNodeoptionGoto();
public:
	int ShowInputNodeName(void);
public:
	afx_msg void OnToolsNaivepath();
};

const int ZoomScaler[]={1, 2, 5, 10};

#ifndef _DEBUG  // debug version in map863View.cpp
inline Cmap863Doc* Cmap863View::GetDocument() const
   { return reinterpret_cast<Cmap863Doc*>(m_pDocument); }
#endif

